package com.yc3.user;

import com.yc3.system.Measure;
import org.springframework.stereotype.Component;

/**
 * @ClassName StudentBmiMeasure
 * @since: 2023/7/26 09:58
 * @auth: kirito
 * @description:
 **/
@Component("bmimeasure")
public class StudentBmiMeasure implements Measure {
    @Override
    public double doMeasure(Object object) {
        if (object == null) {
            throw new RuntimeException("该数据异常");
        }
        if (!(object instanceof student)) {
            throw new RuntimeException("该数据异常");
        }
        student s = (student)object;
        return s.getWeight()/(s.getHeight() * s.getHeight());
    }
}
